<template>
  <div class="app-container">
    <Header />
    <main class="main-container">
      <div class="dashboard-container">
        <!-- Statistics Overview -->
        <div class="stats-grid">
          <div class="stat-card">
            <div class="stat-header">
              <div>
                <div class="stat-label">今日查询次数</div>
                <div class="stat-value">1,246</div>
              </div>
              <div class="stat-icon primary">📊</div>
            </div>
            <div class="stat-footer">
              <span class="stat-trend trend-up">↑ 12.5%</span>
              <span>较昨日</span>
            </div>
          </div>
          
          <div class="stat-card">
            <div class="stat-header">
              <div>
                <div class="stat-label">文档处理数</div>
                <div class="stat-value">89</div>
              </div>
              <div class="stat-icon success">📄</div>
            </div>
            <div class="stat-footer">
              <span class="stat-trend trend-up">↑ 8.3%</span>
              <span>较昨日</span>
            </div>
          </div>
          
          <div class="stat-card">
            <div class="stat-header">
              <div>
                <div class="stat-label">活跃用户</div>
                <div class="stat-value">423</div>
              </div>
              <div class="stat-icon warning">👥</div>
            </div>
            <div class="stat-footer">
              <span class="stat-trend trend-up">↑ 5.2%</span>
              <span>较昨日</span>
            </div>
          </div>
          
          <div class="stat-card">
            <div class="stat-header">
              <div>
                <div class="stat-label">系统响应时间</div>
                <div class="stat-value">0.8s</div>
              </div>
              <div class="stat-icon danger">⚡</div>
            </div>
            <div class="stat-footer">
              <span class="stat-trend trend-down">↓ 15%</span>
              <span>优化提升</span>
            </div>
          </div>
        </div>

        <!-- Market Overview -->
        <div class="panel-card">
          <div class="panel-header">
            <h3 class="panel-title">市场概览</h3>
            <a href="#" class="view-all">查看全部</a>
          </div>
          <div class="market-list">
            <div class="market-item">
              <div class="market-info">
                <span class="market-name">上证指数</span>
                <span class="market-code">000001.SH</span>
              </div>
              <div class="market-price">
                <div class="price-value">3,125.45</div>
                <span class="price-change price-up">+1.23%</span>
              </div>
            </div>
            <div class="market-item">
              <div class="market-info">
                <span class="market-name">深证成指</span>
                <span class="market-code">399001.SZ</span>
              </div>
              <div class="market-price">
                <div class="price-value">10,456.78</div>
                <span class="price-change price-up">+0.89%</span>
              </div>
            </div>
            <div class="market-item">
              <div class="market-info">
                <span class="market-name">创业板指</span>
                <span class="market-code">399006.SZ</span>
              </div>
              <div class="market-price">
                <div class="price-value">2,234.56</div>
                <span class="price-change price-down">-0.45%</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
  </div>
</template>

<script>
import Header from './Header.vue';
export default {
  name: 'Dashboard',
  components: {
    Header
  }
};
</script>

<style scoped>
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-container {
  flex: 1;
  padding: 20px;
  background-color: #f5f7fa;
}

.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Statistics Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.stat-label {
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark-color);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.primary {
  background: rgba(74, 144, 226, 0.1);
  color: var(--primary-color);
}

.stat-icon.success {
  background: rgba(92, 184, 92, 0.1);
  color: var(--secondary-color);
}

.stat-icon.warning {
  background: rgba(240, 173, 78, 0.1);
  color: var(--warning-color);
}

.stat-icon.danger {
  background: rgba(217, 83, 79, 0.1);
  color: var(--danger-color);
}

.stat-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

.trend-up {
  color: var(--secondary-color);
}

.trend-down {
  color: var(--danger-color);
}

/* Market Overview */
.panel-card {
  background: white;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark-color);
}

.view-all {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
}

.market-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.market-item:last-child {
  border-bottom: none;
}

.market-info {
  display: flex;
  flex-direction: column;
}

.market-name {
  font-weight: 600;
  color: var(--dark-color);
}

.market-code {
  font-size: 0.85rem;
  color: #6c757d;
}

.market-price {
  text-align: right;
}

.price-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.price-change {
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.2rem;
  display: inline-block;
}

.price-up {
  color: var(--danger-color);
  background: rgba(217, 83, 79, 0.1);
}

.price-down {
  color: var(--secondary-color);
  background: rgba(92, 184, 92, 0.1);
}
</style>